import React, { Component } from 'react';
import request from "../../api"
import "./threelist.css"

interface Props {
    title: string,
    zifenlei: string
}
interface State {
    threelist: ListItem[]
}
interface ListItem{
    img1:string,
    brand:string
}

class Threelist extends Component<Props, State> {
    constructor(props:Props){
        super(props);
        this.state = {
            threelist:[]
        }
    }
    componentDidMount() {
        request.mypro.pro_categorybrandprolist(this.props.zifenlei, this.props.title).then((ok) => {
            this.setState({threelist:ok.data.data},()=>{
                console.log(this.state.threelist);
                
            })
        })
    }
    render() {
        return (
            <div className='threelistclass'>
                {
                    this.state.threelist.map((item,index)=>{
                        return(
                            <div key={index} className="thelist">
                                <img src={item.img1} alt="" />
                                <p>{item.brand}</p>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default Threelist;